<?php

/**********************************CUSTOMER CLASS******************************/

	//hit the database
	require_once '../database/sql.php';
	require_once '../menu_page/instructions.php';

	//store data specific to the customer
	class CUSTOMER {

	//public:

		//customer's table number
		public $rows;
		public $cost;
		public $position;
		public $calories;

		//what customer's eating/drinking
		public $drink; 
		public $plate;

		//constructor
		public function __construct($num) {
			$this->position = $num;
			$this->rows = sql_load();
		} //conclude constructor
		
		//drinks customer's ordering
		public function meal() {

			//collect all possible arguments
			$args = func_get_args();

			//loop through each argument
			foreach($args as $values) 
				foreach($values as $index => $active) {
					switch($index) { //filter arguments
						case 'drink':
							$this->drink[$active] = $this->rows['drinks'][$active];
							$this->calories += $this->drink[$active]['calories'];
							$this->cost += $this->drink[$active]['cost'];
							break;
						case 'plate':
							$this->plate[$active] = $appetizers[$active];
							$this->calories += $this->plate[$active]->get_calories();
							$this->cost += $this->plate[$active]->get_cost();
							break;
					} //end switch
				} //end loop
		} //concludes meals 

/************************edit here*************************************/
		//assign plates
		public function plate($obj) {
			$this->plate[] = $obj;
			$this->cost += $obj->get_cost();
			$this->calories += $obj->get_calories();
		} //conclude plates
/************************edit here*************************************/

		//show current customer information
		public function output() {
			$str = "$this->position\n";
			$str .= "$this->calories\n";
			$str .= "$this->cost\n";
			$str .= print_r($this->drink,true);
			$str .= print_r($this->plate,true);
			return $str;
		} //end output function
	} //conclude class
?>
